const router = require('express').Router();
const upload = require('../utils/upload')

// 显示上传文件的页面的
router.get('/upload', (req, res) => {
  res.render('upload')
})
// 上传文件路由
router.post('/upload', upload.single('file'), (req, res) => {
  
  // /static/uploads/filename
  res.send({
    code: 200,
    msg: '上传成功',
    data: {
      url: '/static/uploads/' + req.file.filename
    }
  })
})


module.exports = router;